package com.rh.controller;

import com.rh.Enums;
import com.rh.dto.Result;
import com.rh.entity.Education;
import com.rh.excrptions.DoException;
import com.rh.service.EducationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@CrossOrigin
@Controller
@ResponseBody
public class EnucationController {

    @Autowired
    private EducationService educationService;
    /**
     * 获取列表
     */
    @RequestMapping("/getEducationList")
    public Result getEducationList() {
        try {
            List<Education> educationAll = educationService.getEducationAll();
            Result result = new Result();
            result.setData(educationAll);
            return result;
        }catch (Exception e){
            throw new DoException(Enums.GETLIST_ERROR);
        }
    }
}
